Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/component/PowerMetrics.kt 2d20cd8a4708e2ef66e98d5259f3a97ec93f240a (2d20cd8a) Text, 2.73 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.node.component

Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787org.meshtastic.core.common.util.NumberFormatter
Tff7b72import T7ee787org.meshtastic.core.model.Node
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.channel_1
Tff7b72import T7ee787org.meshtastic.core.resources.channel_2
Tff7b72import T7ee787org.meshtastic.core.resources.channel_3
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MeshtasticIcons
Tff7b72import T7ee787org.meshtastic.core.ui.icon.PowerSupply
Tff7b72import T7ee787org.meshtastic.core.ui.icon.Voltage
Tff7b72import T7ee787org.meshtastic.feature.node.model.VectorMetricInfo

T8b949e/**
* Displays power metrics for a node: for every channel reporting a voltage, its voltage and — when the channel reports
* one — its current are stacked in a single vertical column so the pair stays visually grouped and the columns flow
* side by side.
*/
Tf0883e@Composable
Tff7b72internal Tff7b72fun Td2a8ffPowerMetricsTb4b4b4(Te6edf3nodeTb4b4b4: Te6edf3NodeTb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3channels Tff7b72=
Te6edf3withTb4b4b4(Te6edf3nodeTb4b4b4.Te6edf3powerMetricsTb4b4b4) Tb4b4b4{
Te6edf3listOfTb4b4b4(
Te6edf3TripleTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3channel_1Tb4b4b4, Te6edf3ch1_voltageTb4b4b4, Te6edf3ch1_currentTb4b4b4)Tb4b4b4,
Te6edf3TripleTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3channel_2Tb4b4b4, Te6edf3ch2_voltageTb4b4b4, Te6edf3ch2_currentTb4b4b4)Tb4b4b4,
Te6edf3TripleTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3channel_3Tb4b4b4, Te6edf3ch3_voltageTb4b4b4, Te6edf3ch3_currentTb4b4b4)Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4.Te6edf3mapNotNull Tb4b4b4{ Tb4b4b4(Te6edf3labelTb4b4b4, Te6edf3voltageTb4b4b4, Te6edf3currentTb4b4b4) Tff7b72-Tff7b72>
T8b949e// Voltage and current both carry presence: an absent reading is hidden, but a reported 0V / 0mA is a
T8b949e// real measurement and is shown.
Te6edf3voltageTff7b72?.Te6edf3let Tb4b4b4{ Te6edf3volts Tff7b72-Tff7b72>
Te6edf3listOfNotNullTb4b4b4(
Te6edf3VectorMetricInfoTb4b4b4(Te6edf3labelTb4b4b4, Ta5d6ff"Tffd700${Te6edf3NumberFormatterTb4b4b4.Te6edf3formatTb4b4b4(Te6edf3voltsTb4b4b4, T79c0ff2Tb4b4b4)Tffd700}Ta5d6ffVTa5d6ff"Tb4b4b4, Te6edf3MeshtasticIconsTb4b4b4.Te6edf3VoltageTb4b4b4)Tb4b4b4,
Te6edf3currentTff7b72?.Te6edf3let Tb4b4b4{ Te6edf3milliAmps Tff7b72-Tff7b72>
Te6edf3VectorMetricInfoTb4b4b4(
Te6edf3labelTb4b4b4,
Ta5d6ff"Tffd700${Te6edf3NumberFormatterTb4b4b4.Te6edf3formatTb4b4b4(Te6edf3milliAmpsTb4b4b4, T79c0ff1Tb4b4b4)Tffd700}Ta5d6ffmATa5d6ff"Tb4b4b4,
Te6edf3MeshtasticIconsTb4b4b4.Te6edf3PowerSupplyTb4b4b4,
Tb4b4b4)
Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Te6edf3MetricCardFlowTb4b4b4(Te6edf3groups Tff7b72= Te6edf3channelsTb4b4b4)
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s